package com.bestcem.xm.user.enums;


import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 订单类型
 *
 * @author Linzhijian <zhijian.lin@idiaoyan.com>
 * @version v1.0
 * @date 2022/05/20514:14
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum PaymentMethodEnum {

    /**
     * 支付方式枚举
     */
    PAYMENT_METHOD_UNSPECIFIED(0, "未指定"),
    PAYMENT_METHOD_WECHAT(1, "微信支付"),
    PAYMENT_METHOD_ALIPAY(2, "支付宝支付"),
    PAYMENT_METHOD_OFFLINE(3, "对公转账"),
    PAYMENT_METHOD_UNION_PAY(4, "银联支付");

    /**
     * 状态
     */
    private Integer type;
    /**
     * 状态描述
     */
    private String desc;

    /**
     * 通过type获取
     *
     * @param type
     * @return
     */
    public static PaymentMethodEnum getByType(Integer type) {
        if (type != null) {
            for (PaymentMethodEnum value : values()) {
                if (value.getType().equals(type)) {
                    return value;
                }
            }
        }
        return null;
    }

}
